package com.azf.springboot2.demos.controller;

import com.azf.springboot2.demos.common.Result;
import com.azf.springboot2.demos.entity.StudentList;
import com.azf.springboot2.demos.entity.vo.StudentGradVO;
import com.azf.springboot2.demos.service.Voservice;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/*
功能描述:实现增删改查
作者：14136
创造日期：2024/11/19
*/
@RestController
@RequestMapping(value = "vo")
public class VoController {
    @Resource
    private Voservice voService;

    @GetMapping("/list")

    public Result<List<StudentGradVO>> List() {
        List<StudentGradVO> list = voService.list();
        return new Result<>().Success(list);
    }
//    public List<StudentGradVO> List() {
//       List<StudentGradVO> list = voService.list();
//        return list;
//   }
    /*
    * 新增
     */
    @PostMapping("/insert")
    public  Result insert(@RequestBody StudentList vo ){
        voService.insert(vo);
        return new Result<>().Success();
    }
    /*
    * 修改
     */
    @PutMapping("/update")
    public  Result updata(@RequestBody StudentGradVO vo) {
        voService.update(vo);
        return new Result<>().Success();
    }
    /*
    * 删除
     */
    @DeleteMapping("/delete/{ids}")
    public  Result delete(@PathVariable Integer[] ids) {
        voService.delete(ids);
        return new Result<>().Success();
    }


}
